//
//  UIButton+Extension.swift
//  Sina
//
//  Created by 袁量 on 2016/11/29.
//  Copyright © 2016年 袁量. All rights reserved.
//

import UIKit
extension UIButton
{
    convenience init(imageName: String, backgroundImageName: String)
    {
        self.init()
        setImage(UIImage(named: imageName), for: UIControlState.normal)
        setImage(UIImage(named: imageName + "_highlighted"), for: UIControlState.highlighted)
        setBackgroundImage(UIImage(named: backgroundImageName), for: UIControlState.normal)
        setBackgroundImage(UIImage(named: backgroundImageName + "_highlighted"), for: UIControlState.highlighted)
        sizeToFit()
        
    }
    convenience init(bgColor : UIColor, fontSize : CGFloat, title : String) {
        self.init()
        
        setTitle(title, for: UIControlState())
        backgroundColor = bgColor
        titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
    }

}
